n,d=map(int,input().split())
o=0
if n in [1,3,5,7,8,10,12]:
if d==7 or d==6:
o=6
else:
o=5
if n in [4,6,9,11]:
if d==7:
o=6
else:
o=5
if n==2:
if d==1:
o=4
else:
o=5
print(o)
#include <bits/stdc++.h>
using namespace std;
int movecalc(int big, int small)
{
int moves = 0;
int a = small;
int b = big;
while (true)
{
if (((1.00) * b) / a <= 2.00)
{
return moves;
}
else
{
a = 2 * a;
++moves;
}
}
}
int main()
{
int n ;
cin >> n ;
int wd ;
cin >> wd ;
if(n == 1 or n== 3 or n == 5 or n == 7 or n == 8 or n == 10 or n == 12){
if(wd+2 > 7){
cout << "6" <<endl;
}
else{
cout << "5" <<endl;
}
}
else if(n == 4 or n == 6 or n == 9 or n == 11){
if(wd+1 > 7){
cout << "6" <<endl;
}
else{
cout << "5" <<endl;
}
}else{
if(wd == 1){
cout << "4" <<endl;
}
else{
cout << "5" <<endl;
}
}
return 0;
}
450A - Jzzhu and Children | 546A - Soldier and Bananas |
32B - Borze | 1651B - Prove Him Wrong |
381A - Sereja and Dima | 41A - Translation |
1559A - Mocha and Math | 832A - Sasha and Sticks |
292B - Network Topology | 1339A - Filling Diamonds |
910A - The Way to Home | 617A - Elephant |
48A - Rock-paper-scissors | 294A - Shaass and Oskols |
1213A - Chips Moving | 490A - Team Olympiad |
233A - Perfect Permutation | 1360A - Minimal Square |
467A - George and Accommodation | 893C - Rumor |
227B - Effective Approach | 1534B - Histogram Ugliness |
1611B - Team Composition Programmers and Mathematicians | 110A - Nearly Lucky Number |
1220B - Multiplication Table | 1644A - Doors and Keys |
1644B - Anti-Fibonacci Permutation | 1610A - Anti Light's Cell Guessing |
349B - Color the Fence | 144A - Arrival of the General |